package com.clstu.threaduse;

public class Thread03 {
    public static void main(String[] args) {
        new Thread(new Hello()).start();
        new Thread(new Hi()).start();
    }
}

class Hello implements Runnable{
    int time=0;
    @Override
    public void run() {
        while (true) {
            System.out.println("hello World !!-------"+(++time));
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            if(time>=30) break;
        }
    }
}

class Hi implements Runnable{
    int time=0;
    @Override
    public void run() {
        while (true) {
            System.out.println("hi   !!-------"+(++time));
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            if (time>=50) break;
        }
    }
}